package com.xiaoyu.awakening.ai.index.controller;

import com.xiaoyu.awakening.ai.index.api.IAwkIndexTaskControllerApi;
import com.xiaoyu.awakening.ai.index.entity.req.AwkIndexTaskReq;
import com.xiaoyu.awakening.ai.index.entity.res.AwkIndexTaskStatusDTO;
import com.xiaoyu.awakening.ai.index.service.IAwkIndexTaskService;
import com.xiaoyu.awakening.common.core.dto.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangxiaoyu
 * @date 2025/6/25 11:53
 * @since v1.0
 */
@RestController
public class AwkIndexTaskController implements IAwkIndexTaskControllerApi {
    @Resource
    private IAwkIndexTaskService awkIndexTaskService;

    @Override
    public Result<AwkIndexTaskStatusDTO> commitTask(AwkIndexTaskReq awkIndexTaskReq) {
        AwkIndexTaskStatusDTO awkIndexTaskStatusDTO = awkIndexTaskService.commitTask(awkIndexTaskReq);
        if (awkIndexTaskStatusDTO != null) {
            return Result.success(awkIndexTaskStatusDTO);
        }
        return Result.fail("提交任务失败");
    }

    @Override
    public Result<AwkIndexTaskStatusDTO> taskStatus(String taskId) {
        AwkIndexTaskStatusDTO awkIndexTaskStatusDTO = awkIndexTaskService.queryTaskStatus(taskId);
        if (awkIndexTaskStatusDTO != null) {
            return Result.success(awkIndexTaskStatusDTO);
        }
        return Result.fail("查询任务状态失败");
    }

    @Override
    public Result<AwkIndexTaskStatusDTO> pause(String taskId) {
        return null;
    }

    @Override
    public Result<AwkIndexTaskStatusDTO> pauseAll() {
        return null;
    }

    @Override
    public Result<AwkIndexTaskStatusDTO> resume() {
        return null;
    }

}
